package com.attendance.web;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 统一返回结果
 *
 * @author 鵺丶
 * @date 2021/03/09
 */
@Data
@NoArgsConstructor
public class Result {

    private boolean success;
    private Integer code;
    private String message;
    private Object data;

    public Result(ResultCode code) {
        this.success = code.getSuccess();
        this.code = code.getCode();
        this.message = code.getMessage();
    }

    public Result(ResultCode code,Object data) {
        this.success = code.getSuccess();
        this.code = code.getCode();
        this.message = code.getMessage();
        this.data = data;
    }

    public Result(Integer code,String message,boolean success) {
        this.code = code;
        this.message = message;
        this.success = success;
    }
}